Test Series - Data Structure

Test Number 65/115

Q: Which algorithm is used in the top tree data structure?
A. Divide and Conquer
B. Greedy
C. Backtracking
D. Branch
Solution: Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems. It allows an algorithm called divide and conquer.
Q: For how many vertices in a set, is top tree defined for underlying tree?
A. 3
B. 4
C. 5
D. 2
Solution: Top tree is defined for a set having a maximum of 2 vertices for its underlying tree. Those sets having at maximum 2 vertices is called External Boundary Vertices.
Q: How many edges are present in path cluster?
A. 2
B. 3
C. 6
D. 1
Solution: There are at least 2 edges present in path cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.
Q: How many edges does a leaf cluster contain?
A. 0
B. 1
C. 2
D. 3
Solution: If a cluster has no edges and contains only one vertex known as boundary vertex then, it is known as leaf cluster. So a leaf cluster doesn’t contain any edges. It is also known as Point cluster.
Q: How many edges are present in Edge cluster?
A. 0
B. 1
C. 2
D. 3
Solution: A cluster containing only single edge is known as Edge cluster. So there are in total 1 edge present in edge cluster. Cluster in data structure is defined as the subtree that is connect having maximum of 2 vertices known as Boundary Vertices.
Q: Which data structure is used to maintain a dynamic forest using a link or cut operation?
A. Top Tree
B. Array
C. Linked List
D. Stack
Solution: Top tree data structure is used to maintain a dynamic forest using link or cut operations. Top tree is a type of data structure which is based on unrooted dynamic binary tree and is used to solve path related problems.
Q: What is the time complexity for the initialization of top tree?
A. O (n)
B. O (n2)
C. O (log n)
D. O (n!)
Solution: Generally, trees have weight on its edges. Also there is one to one correspondence of the edges with the top trees. Therefore, top trees can be initialized in O (n) time.
Q: How many top trees are there in a tree with single vertex?
A. 0
B. 1
C. 2
D. 3
Solution: Tree having a single vertex has no clusters of tree present in the structure. Therefore, there are empty top trees in a tree having a single vertex. Trees with one node are single node.
Q: Which property makes top tree a binary tree?
A. Nodes as Cluster
B. Leaves as Edges
C. Root is Tree Itself
D. All of the mentioned
Solution: Top tree can be considered as a binary tree if the nodes form a cluster, leaves act as an edge and the root of the top tree acts as a tree itself. Then the top tree is called binary tree.
Q: Which of the dynamic operations are used in Top Tree data structure implementation?
A. Link
B. Cut
C. Expose
D. All of the mentioned
Solution:  Link returns a single tree having different vertices from top trees. Cut removes the edge from the top tree. Expose is used to implement queries on top trees. Hence all of the options are used as dynamic operations.

You Have Score    /10